<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    <div class="container-div">
		<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
			<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="module:depotHead:add">
				<i class="fa fa-plus"></i> 入库
			</a>
		<!-- 	<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="module:depotHead:edit">
	            <i class="fa fa-edit"></i> 修改
	        </a>
			<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="module:depotHead:remove">
				<i class="fa fa-remove"></i> 删除
			</a> -->
		</div>
			
		<div class="col-sm-12 select-table table-striped">
			<table id="bootstrap-table" data-mobile-responsive="true"></table>
		</div>
    </div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('module:depotHead:edit')}]];
        var removeFlag = [[${@permission.hasPermi('module:depotHead:remove')}]];
        var prefix = ctx + "module/depotHead";
        var depotHeadStatus = [[${@dict.getType('gh_depotHead_status')}]];
        var labelType = [[${@dict.getType('gh_label_type')}]];
        var listFlag = [[${@permission.hasPermi('system:dict:list')}]];
        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
                sortName: "id",
		        sortOrder: "desc",
                modalName: "入库记录",
                columns: [{
		            checkbox: true
		        },
				{
					field : 'id', 
					title : '主键id' ,
					visible: false
				},
				{
					field : 'depotHeadNo', 
					title : '入库批次号' 
				},
				{
					field : 'createTime', 
					title : '入库时间' 
				},
				{
					field : 'amount', 
					title : '入库数量' 
				},
				{
					field : 'itemFileName', 
					title : '明细文件名称' 
				},
				{
					field : 'tagType', 
					title : '标签类型',
					align: 'center',
				    formatter: function(value, row, index) {
				            return $.table.selectDictLabel(labelType, value);
				       }
				},
				{
					field : 'beginSerialNumber', 
					title : '起始序列号' 
				},
				{
					field : 'endSerialNumber', 
					title : '结束序列号' 
				},
				{
					field : 'status', 
					title : '状态' ,
					align: 'center',
				    formatter: function(value, row, index) {
				            return $.table.selectDictLabel(depotHeadStatus, value);
				       }
				},
				{
					field : 'currentSerialNumber', 
					title : '当前序列号' 
				},
				{
					field : 'usedAmount', 
					title : '已使用数量' 
				},
				{
					field : 'unusedAmount', 
					title : '未使用数量' 
				},
				{
					field : 'updateTime', 
					title : '更新时间' 
				},
				{
					field : 'remark', 
					title : '备注' 
				},
		         {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	 actions.push('<a class="btn btn-info btn-xs ' + listFlag + '" href="#" onclick="detail(\'' + row.id + '\')"><i class="fa fa-list-ul"></i>明细</a> ');
		            	/* actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>'); */
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);
        });
        /*字典列表-详细*/
		function detail(id) {
		    var url = prefix + '/detail/' + id;
		    createMenuItem(url, "入库明细");
		}
    </script>
</body>
</html>